Skip to content

dgb(#82): DGBWorkSource IWorkSource Stage-4a skeleton — miner-facing path - #186

Merged
frstrtr merged 1 commit into
masterfrom
dgb/stratum-work-source-skeleton
Jun 19, 2026
Merged

dgb(#82): DGBWorkSource IWorkSource Stage-4a skeleton — miner-facing path#186
frstrtr merged 1 commit into
masterfrom
dgb/stratum-work-source-skeleton

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 19, 2026

Copy link
Copy Markdown
Owner

#82 miner-facing path — DGBWorkSource (IWorkSource) Stage 4a skeleton

Concrete dgb::stratum::DGBWorkSource : core::stratum::IWorkSource bridging the coin-agnostic core::StratumServer to DGB-Scrypt work generation + share validation. 1:1 mirror of btc::stratum::BTCWorkSource's own 4a landing.

Scope (skeleton — intentionally non-functional but real-compiling):

  • All IWorkSource pure virtuals overridden; class instantiates over the live coin deps (HeaderChain + Mempool + submit-block callback).
  • Work-generation getters return documented empty/default forms (4c fills them).
  • mining_submit rejects every submission as low-difficulty WITHOUT reaching the won-block broadcaster (4d).
  • compute_share_difficulty returns the 0.0 not-yet sentinel — vardiff gate hard-rejects, no garbage diff leaks into the rate monitor before the real scrypt_1024_1_1_256 assembly (4b/4c).

Tests: dgb_work_source_test 10/10 PASS — IWorkSource contract, work-generation atomics, worker registry round-trip, stub-safety (broadcaster not reached), and the diff sentinel. Wired into dgb CMake + BOTH build.yml --target allowlists (#143 NOT_BUILT trap avoided).

Isolation: single-coin (src/impl/dgb/ only), no shared-base / bitcoin_family touch, no -DAUX_DOGE.

Sequencing: next stacked slice = stand the StratumServer up in main_dgb.cpp over this work source, then bind make_on_block_found(reconstruct_won_block, p2p_sink) into m_on_block_found AND wire the RPC arm (rpc.cpp:387) — closing #82's dual-path gate (won-block-reaches-network on BOTH embedded P2P relay + submitblock RPC fallback).

HOLD merge — integrator merges on operator push approved. Land #183 (storage net_name conform) first per the per-coin isolation invariant.

…path

Concrete dgb::stratum::DGBWorkSource bridges the coin-agnostic
core::StratumServer to DGB-Scrypt work generation + share validation,
mirroring btc::stratum::BTCWorkSource's 4a landing. Skeleton compiles,
instantiates over the live coin deps, and pins the full IWorkSource
contract so the StratumServer wiring in main_dgb.cpp can be validated
end-to-end before the substantive logic lands.

All work-generation getters return documented empty/default forms;
mining_submit rejects every submission as low-difficulty WITHOUT reaching
the won-block broadcaster; compute_share_difficulty returns the 0.0
not-yet sentinel (vardiff hard-reject — no garbage diff leaks). The real
scrypt_1024_1_1_256 assembly + share-classification hot path land in
4b/4c/4d.

dgb_work_source_test: 10/10 PASS (IWorkSource contract + atomics +
worker registry + stub-safety + sentinel). Wired into dgb_dgb CMake +
BOTH build.yml --target allowlists (#143 NOT_BUILT trap avoided).
Single-coin, no shared-base/bitcoin_family touch, no -DAUX_DOGE.
@frstrtr
frstrtr force-pushed the dgb/stratum-work-source-skeleton branch from 4d51798 to 93c105b Compare June 19, 2026 08:03
frstrtr added a commit that referenced this pull request Jun 19, 2026
…RPC arm wired

Stacks on the run-loop (#182 spine + node-construct) and the DGBWorkSource
4a skeleton (#186): closes the SEAM both left for "stand the Stratum work
source up + bind the won-block broadcaster."

--run now constructs the miner-facing path on the run-loop io_context:
  - c2pool::dgb::HeaderChain + dgb::coin::Mempool (MVP-unwired this slice —
    the 4a work source returns default work; mining_submit low-diff-rejects
    via the 0.0 compute_share_difficulty sentinel BEFORE the broadcaster, so
    no garbage block is ever emitted)
  - dgb::coin::CoinNode(nullptr,nullptr) + a SubmitBlockFn bridging
    block_bytes -> hex -> submit_block_hex (rpc.cpp:387, REAL not a stub):
    the submitblock-RPC arm of the #82 dual-path broadcaster. has_rpc()==false
    => returns false LOUDLY (the #163 seam guard: no silent drop).
  - dgb::stratum::DGBWorkSource + core::StratumServer, gated on a new
    --stratum [HOST:]PORT flag (mirrors main_btc.cpp). Acceptor lifecycle is
    wired into the signal_set handler: stratum stop() runs BEFORE ioc.stop()
    so live miner sessions close cleanly.

CMake: link c2pool-dgb against dgb_stratum. Single-coin (no bitcoin_family /
src/core touch); core::StratumServer consumed, not modified. No -DAUX_DOGE.

Remaining for the #82 closer (NEXT slice): the embedded P2P-relay arm
(m_on_block_found -> reconstruct_won_block -> broadcast_won_block) needs the
reconstructor stack (#163/#166/#167/#177), HELD off master. Two-arm
independent broadcast evidence captured once both arms are live.

Build EXIT=0; --run --stratum 127.0.0.1:5022 smoke: StratumServer started,
sharechain peer on 5024, SIGINT -> ordered graceful shutdown (stratum stop
then clean exit), EXIT=0.
@frstrtr
frstrtr merged commit a726179 into master Jun 19, 2026
19 checks passed
frstrtr added a commit that referenced this pull request Jun 19, 2026
…RPC arm wired

Stacks on the run-loop (#182 spine + node-construct) and the DGBWorkSource
4a skeleton (#186): closes the SEAM both left for "stand the Stratum work
source up + bind the won-block broadcaster."

--run now constructs the miner-facing path on the run-loop io_context:
  - c2pool::dgb::HeaderChain + dgb::coin::Mempool (MVP-unwired this slice —
    the 4a work source returns default work; mining_submit low-diff-rejects
    via the 0.0 compute_share_difficulty sentinel BEFORE the broadcaster, so
    no garbage block is ever emitted)
  - dgb::coin::CoinNode(nullptr,nullptr) + a SubmitBlockFn bridging
    block_bytes -> hex -> submit_block_hex (rpc.cpp:387, REAL not a stub):
    the submitblock-RPC arm of the #82 dual-path broadcaster. has_rpc()==false
    => returns false LOUDLY (the #163 seam guard: no silent drop).
  - dgb::stratum::DGBWorkSource + core::StratumServer, gated on a new
    --stratum [HOST:]PORT flag (mirrors main_btc.cpp). Acceptor lifecycle is
    wired into the signal_set handler: stratum stop() runs BEFORE ioc.stop()
    so live miner sessions close cleanly.

CMake: link c2pool-dgb against dgb_stratum. Single-coin (no bitcoin_family /
src/core touch); core::StratumServer consumed, not modified. No -DAUX_DOGE.

Remaining for the #82 closer (NEXT slice): the embedded P2P-relay arm
(m_on_block_found -> reconstruct_won_block -> broadcast_won_block) needs the
reconstructor stack (#163/#166/#167/#177), HELD off master. Two-arm
independent broadcast evidence captured once both arms are live.

Build EXIT=0; --run --stratum 127.0.0.1:5022 smoke: StratumServer started,
sharechain peer on 5024, SIGINT -> ordered graceful shutdown (stratum stop
then clean exit), EXIT=0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant